﻿<phone:PhoneApplicationPage
    x:Class="TheVerge.Phone.Pages.LoginPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:con="clr-namespace:TheVerge.Phone.Controls"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d"
    shell:SystemTray.IsVisible="True">

    <Grid x:Name="LayoutRoot" Background="{StaticResource PhoneBackgroundBrush}" Margin="-1">
        <StackPanel Orientation="Vertical" HorizontalAlignment="Center">
            <TextBlock Text="Login" HorizontalAlignment="Center" Style="{StaticResource PhoneTextTitle1Style}" />

            <StackPanel Orientation="Vertical" Visibility="{Binding IsLoggedIn, Converter={StaticResource falseVisConv}}">
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="User Name: " Width="120" VerticalAlignment="Center" />
                    <TextBox x:Name="tbUserName" Width="300" />
                </StackPanel>
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="Password: " Width="120" VerticalAlignment="Center" />
                    <PasswordBox x:Name="tbPassword" Width="300" />
                </StackPanel>

                <Button Click="Login_Click">
                    <TextBlock Text="Login" Style="{StaticResource PhoneTextTitle3Style}" />
                </Button>
            </StackPanel>
            
            <StackPanel Orientation="Vertical" Visibility="{Binding IsLoggedIn, Converter={StaticResource trueVisConv}}">
                <TextBlock Text="You are logged in. Feel free to comment as much as you'd like!" TextWrapping="Wrap" />
                <Button Content="Log Out" Click="Logout_Click" />
            </StackPanel>

            <con:ProgressBar Visibility="{Binding IsAuthenticating, Converter={StaticResource trueVisConv}}" IsIndeterminate="{Binding IsAuthenticating}" />
        </StackPanel>
    </Grid>

</phone:PhoneApplicationPage>